import {Component, OnInit} from '@angular/core';
import {UtilsService} from '../../service/utils/utils.service';
import {PermissionsService} from '../../service/permissions/permissions.service';

@Component({
    selector: 'app-login',
    templateUrl: './login.component.html',
    styleUrls: ['./login.component.scss'],
})
export class LoginComponent implements OnInit {
    username: string;
    password: number;

    constructor(
        private utils: UtilsService,
        private permissions: PermissionsService
    ) {
        this.username = '';
        this.password = 0;
    }

    ngOnInit() {
    }

    login() {
        console.log(this.username);
        console.log(this.password);
        if (this.username && this.password) {
            this.permissions.getToken();
            this.utils.ShowToast('登录成功', 'top', 1500);
        } else {
            this.utils.ShowToast('账号名或者密码错误!', 'top', 1500);
        }
    }
}
